﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PaperWorld.DTO;
using PaperWorld.Web.Models.Users;

namespace PaperWorld.DTOAdapter
{
    /// <summary>
    /// 用户模型映射
    /// </summary>
    public static class UserModelMapper
    {
        /// <summary>
        /// 将用户登录响应DTO转换为用户登录结果模型
        /// </summary>
        /// <param name="response">用户登录响应DTO</param>
        /// <returns>用户登录结果模型</returns>
        public static LoginResultModel ToLoginResultModel(UserLoginResponse response)
        {
            AutoMapper.Mapper.CreateMap<UserLoginResponse, LoginResultModel>();

            return AutoMapper.Mapper.Map<UserLoginResponse, LoginResultModel>(response);
        }

        /// <summary>
        /// 将用户登录模型转换为用户登录请求DTO
        /// </summary>
        /// <param name="login">用户登录模型</param>
        /// <returns>用户登录请求DTO</returns>
        public static UserLoginRequest ToUserLoginRequest(LoginModel login)
        {

            AutoMapper.Mapper.CreateMap<LoginModel, UserLoginRequest>();

            return AutoMapper.Mapper.Map<LoginModel, UserLoginRequest>(login);
        }
    }
}
